// components/epmty/index.js
Component({
    /**
     * 组件的属性列表
     */
    properties: {
        
    },
    /**
     * 组件的初始数据
     */
    data: {
        
    },
    /**
     * 组件的方法列表
     */
    methods: {
        toIndex() {
            wx.switchTab({
                url: '/pages/index/index',
            });
        },
        clickMc: function () {
            this.setData({
                show_popup_share: false,
                show_popup_poster: false,
                show_save_success: false
            })
        },
        /**
         * 会员 海报弹窗
         */
        handlePopUp(e) {
            if (e.detail.path) {
                this.setData({
                    show_popup_success: false
                }, () => {
                    wx.switchTab({
                        url: '/pages/index/index',
                    })
                })
            } else if (!e.detail || !e.detail.close || !e.currentTarget.dataset.close) {
                this.setData({
                    show_popup: false,
                    show_popup_share: false,
                    show_popup_success: false,
                    show_popup_poster: false,
                    show_save_success: false
                })
                return
            }
        },
        /**
         * 分享方法
         */
        handleShare(e) {
            if (e.detail === "dredge") {
                this.setData({
                    show_popup_share: false,
                    show_popup_poster: true,
                    is_first_popup_poster: false,
                    is_allow_save_image_c: wx.getStorageSync('is_allow_save_image')
                })
            } else if (e.detail === "invite") {
                this.setData({
                    show_popup_share: true,
                    is_first_popup_share: false
                })
            } else {
                this.setData({
                    show_popup_share: false
                })
            }
        },
        inviteFriends() {
            this.setData({
                show_popup_share: true,
                is_first_popup_share: false,
            })
        },
        handlePhotoSaved() {
            this.setData({
                show_popup_poster: false,
                show_save_success: true,
                is_first_save_success: false
            })
        },
        handleRefusePhotoSaved() {
            this.setData({
                is_allow_save_image_c: false
            }, () => {
                wx.setStorageSync('is_allow_save_image', false);
                this.triggerEvent('handleRefusePhotoSaved', false);
            })
        }
    }
})